<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 解构赋值
        // 解构赋值  可以解构任何东西   前提条件 ：左右两边结构一致   右边需是一个存在的东西
        let star = ['刘德华', '张学友', '郭富城', '黎明'];
        let [a, b, c, d] = star;
        console.log(a); //'刘德华'
        console.log(b); //'张学友'
        console.log(c); //'郭富城'
        console.log(d); //'黎明'




        let [aa, bb, cc, [dd, ff, ee], {
            name
        }, xxx, flag] = [1, 2, 3, [4, 5], {
            name: 'zs'
        }, true];
        console.log(aa, bb, cc); //1 2 3
        console.log(dd, ff, ee); //4 5 undefined
        console.log(name); //zs
        console.log(xxx); //true
        console.log(flag); //undefined
    </script>
</body>

</html>